import Vue from 'vue'
import Router from 'vue-router'
import Login from '@/components/Login'
import Home from '@/components/Home'
import BiJi from '@/components/BiJi'
import BiJi_Detail from '@/components/BiJi_Detail'
import FenXi from '@/components/FenXi'
import FenXi_ZhangDan from '@/components/FenXi_ZhangDan'
import ZhangDan from '@/components/ZhangDan'
import ZhangDan_Detail from '@/components/ZhangDan_Detail'
import ZhangDan_Edit from '@/components/ZhangDan_Edit'
import WoDe from '@/components/WoDe'
// error Avoided redundant navigation to current location
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
Vue.use(Router)

var routes = [];
let login = {
  path: '/login',
  name: 'Login',
  component: Login
};
routes.push(login)

let home = {
  path: '/',
  name: 'Home',
  component: Home,
  children: []
};
// 笔记
let biji = {
  path: 'biji',
  component: BiJi
};
home.children.push(biji);
let biji_detail = {
  path: '/biji/:id',
  component: BiJi_Detail
};
// 分析
home.children.push(biji_detail);
let fenxi = {
  path: '/fenxi',
  component: FenXi
};
home.children.push(fenxi);
let fenxi_zhangdan = {
  path: '/fenxi/zhangdan',
  component: FenXi_ZhangDan
};

// 账单
home.children.push(fenxi_zhangdan);
let zhangdan = {
  path: '/zhangdan',
  component: ZhangDan
}
home.children.push(zhangdan);
let zhangdan_detail = {
  path: '/zhangdan/:id',
  component: ZhangDan_Detail
}
home.children.push(zhangdan_detail);
let zhangdan_edit = {
  path: '/zhangdan_edit/:id',
  component: ZhangDan_Edit
}
// 我的
home.children.push(zhangdan_edit);
let wode = {
  path: '/wode',
  component: WoDe
}
home.children.push(wode);



routes.push(home)


export default new Router({
  routes: routes
})
